#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 2e5 + 10;

int n, m, ans, fa[N], res[N];
vector<int> g[N];

int find(int x) {
    return (fa[x] == x) ? x : fa[x] = find(fa[x]);
}

void merge(int x, int y) {
    int fx = find(x), fy = find(y);
    if (fx != fy) {
        ans--;
        fa[fy] = fx;
    }
}

int main() {
    cin >> n >> m;
    for (int i = 1; i <= m; i++) {
        int u, v;
        cin >> u >> v;
        g[u].push_back(v), g[v].push_back(u);
    }

    for (int i = n; i >= 1; i--) {
        res[i] = ans++;
        fa[i] = i;

        for (int j = 0; j < g[i].size(); j++) {
            int nxt = g[i][j];
            if (nxt > i) merge(nxt, i);
        }
    }

    for (int i = 1; i <= n; i++) cout << res[i] << endl;
    
    return 0;
}